package com.open.api.ftp.common;

/**
 * 响应数据体
 */
public class ResponseData<T> extends BaseResponse {

    /**
     * 数据
     */
    private T data;

    public ResponseData() {
    }

    public ResponseData(CodeEnum code) {
        super(code);
    }

    public ResponseData(CodeEnum code, T data) {
        super(code);
        this.data = data;
    }


    public ResponseData(Integer code, String msg, T data) {
        super(code,msg);
        this.data = data;
    }

    public static BaseResponse out(CodeEnum code) {
        return new BaseResponse(code);
    }


    public static <T> ResponseData<T> out(CodeEnum code, T data) {
        return new ResponseData<>(code, data);
    }

    public static <T> ResponseData<T> out(Integer code,String msg, T data) {
       return  new ResponseData<>(code, msg, data);
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResponseData{" +"code="+super.getCode()+";msg="+super.getMsg()+
                ";data=" + data +
                '}';
    }
}
